package result

import "net/http"

type Result struct {
	Code int
	Msg  string
	Data any
}

func New() *Result {
	return &Result{Msg: "", Data: ""}
}

func (r Result) Success() *Result {
	r.Code = http.StatusOK
	return &r
}
func (r Result) SetData(data any) *Result {
	r.Data = data
	return &r
}
func (r Result) SetMsg(msg string) *Result {
	r.Msg = msg
	return &r
}
func (r Result) Fail() *Result {
	r.Code = http.StatusBadRequest
	return &r
}

func (r Result) SetCode(code int) *Result {
	r.Code = code
	return &r
}
